﻿using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections.Generic;
using System.Windows.Forms;

namespace DMTT.Workflow.Activities.Design
{
    public class TreeViewLinkItemCollection : List<TreeViewLinkItem>
    {

        public TreeViewLinkItemCollection()
        {
        }
		
        public TreeViewLinkItem Add(
			TreeNode sourceNode,
            TreeNode destinationNode)
		{
            TreeViewLinkItem node = new TreeViewLinkItem(sourceNode, destinationNode);
            base.Add(node);
            return node;
        }

        public new void Remove(TreeViewLinkItem node)
        {
            if (node != null)
            {
                base.Remove(node);
                this.OnTreeViewLinkDeleted(new TreeViewLinkDeletedEventArgs(node.SourceNode));
            }
        }


        #region TreeViewLinkDeleted

        public event TreeViewLinkDeletedEventHandler TreeViewLinkDeleted;

        protected virtual void OnTreeViewLinkDeleted(TreeViewLinkDeletedEventArgs e)
        {
            if (TreeViewLinkDeleted != null)
            {
                TreeViewLinkDeleted(this, e);
            }
        }

        #endregion

    }
}
